<template>
  <div class="listTwo">
    <ul>
      <li v-for="pro in products" :key="pro.name"> {{ pro.name }} ${{ pro.price }}</li>
    </ul>
    <button id="btn2" @click="reducePrice(4)">按钮2</button>
  </div>
</template>
<script>
export default {
  data(){
    return {

    }
  },
  methods:{
    reducePrice(amount){
      this.$store.dispatch('reducePrice',amount)
    } 
  },
  computed:{
    products(){
      return this.$store.getters.getpro
    }
  }
}
</script>
<style lang="less" scoped>
  .listTwo{
    background-color: green;
    max-width: 500px;
    ul{
      list-style: none;
      li{
        width:85%;
        padding: 10px;
        margin:5px;
        background-color: yellow;
      }
    }
  }

</style>